<?php
/**
 * Project  	Newsletter for Joomla 1.5.x
 * Release    	2.0.x
 * @package		Communicator
 * @subpackage	Module helper
 * @version		$Id$
 * @link 		http://joomlacode.org/gf/project/communicator/
 * @copyright	Copyright (c) 2009 Erik Damke - All rights reserved
 * @license		GNU/GPL, see LICENSE.php
 *
 * This program is free software; under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

class modCommunicatorSubscribeHelper
{
	function getReturnURL($params, $type)
	{
		if($itemid =  $params->get($type))
		{
			$menu =& JSite::getMenu();
			$item = $menu->getItem($itemid);
			$url = $item->link.'&Itemid='.$itemid;
		}
		else
		{
			// Redirect to login
			$uri = JFactory::getURI();
			$url = $uri->toString();
		}

		return base64_encode($url);
	}

	function getType()
	{
		$user =& JFactory::getUser();
		return (!$user->get('guest')) ? 'logout' : 'login';
	}
}
